@@ -170,6 +170,17 @@ def eqpt_result(request): |
||
170 | 170 |
'fever_num': fever_num, |
171 | 171 |
}) |
172 | 172 |
|
173 |
+def protect_user_privacy(field): |
|
174 |
+ if (field.get('key', '') == 'phone'): |
|
175 |
+ phone = list(field.get('value', '')) |
|
176 |
+ phone[3:7] = '****' |
|
177 |
+ return ''.join(phone) |
|
178 |
+ elif (field.get('key', '') == 'name'): |
|
179 |
+ name = list(field.get('value', '')) |
|
180 |
+ name[1] = '*' |
|
181 |
+ return ''.join(name) |
|
182 |
+ |
|
183 |
+ return field.get('value', '') |
|
173 | 184 |
|
174 | 185 |
def get_screen_data(point=None, point_id=None): |
175 | 186 |
if not point: |
@@ -180,11 +191,11 @@ def get_screen_data(point=None, point_id=None): |
||
180 | 191 |
|
181 | 192 |
# eqpts = ThermometerEquipmentInfo.objects.filter(point_id=point.point_id, active_status=ThermometerEquipmentInfo.ONLINE, status=True) |
182 | 193 |
|
183 |
- ipuis = IsolationPointUserInfo.objects.filter(point_id=point.point_id, status=True) |
|
194 |
+ ipuis = IsolationPointUserInfo.objects.filter(point_id=point.point_id, status=True).order_by('-last_submit_at') |
|
184 | 195 |
total_active_eqpt_num = ipuis.count() |
185 | 196 |
|
186 | 197 |
ipuis = [{**ipui.data, **{ |
187 |
- field.get('key', ''): field.get('value', '') for field in ipui.fields }} for ipui in ipuis] |
|
198 |
+ field.get('key', ''): protect_user_privacy(field) for field in ipui.fields }} for ipui in ipuis] |
|
188 | 199 |
|
189 | 200 |
|
190 | 201 |
has_upload_temperature_num = len([1 for ipui in ipuis if ipui.get('temperature_has_upload', '') == IsolationPointUserInfo.HAS_YET_UPLOAD]) |
@@ -78,6 +78,8 @@ def save_point_fields(request): |
||
78 | 78 |
user_id = request.POST.get('user_id', '') |
79 | 79 |
fields = get_query_value(request, 'fields', val_cast_type='listjson') |
80 | 80 |
|
81 |
+ IsolationPointUserInfo.objects.exclude(point_id=point_id).update(status=False) |
|
82 |
+ |
|
81 | 83 |
IsolationPointUserInfo.objects.update_or_create(point_id=point_id, user_id=user_id, defaults={ |
82 | 84 |
'fields': fields, |
83 | 85 |
'status': True, |